package com.zb_study.poly_.polyparameter_;

public class PolyParameter {
    public static void main(String[] args) {
        Worker tom = new Worker("tom", 3000);
        Manager jack = new Manager("jack", 5000, 10000);
        PolyParameter polyParameter = new PolyParameter();
        polyParameter.showEmpAnnual(tom);
        polyParameter.showEmpAnnual(jack);
        polyParameter.testWork(tom);
        polyParameter.testWork(jack);
    }


    public void showEmpAnnual(Employee e) {
        System.out.println(e.getAnnual());
    }

    public void testWork(Employee e) {
        if(e instanceof Worker) {
            ((Worker) e).work();
        } else if(e instanceof Manager) {
            ((Manager) e).manager();
        } else {
            System.out.println("不做处理");
        }
    }
}



